package com.lanfan.controller.admin;

import com.lanfan.entity.ResponseResult;
import com.lanfan.entity.Todaymenu;
import com.lanfan.entity.TodaymenuPage;
import com.lanfan.service.TodaymenuService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController("adminTodaymenuController")
@RequestMapping("/admin/todaymenu")
public class TodaymenuController {
    @Resource
    private TodaymenuService todaymenuService;
    @PostMapping("/save")
    public ResponseResult save(@RequestBody Todaymenu todaymenu){
        todaymenuService.save(todaymenu);
        ResponseResult responseResult=new ResponseResult<>();
        return responseResult;
    }
    //删
    @DeleteMapping("/delete/{tid}")
    public ResponseResult delete(@PathVariable Integer tid){
        todaymenuService.delete(tid);
        ResponseResult responseResult=new ResponseResult<>();
        return responseResult;
    }
    @PostMapping("/search")
    public ResponseResult search(@RequestBody TodaymenuPage todaymenuPage){
        /*
        引用传递
         */

        ResponseResult responseResult=new ResponseResult<>();
        todaymenuService.search(todaymenuPage);
        responseResult.setDate(todaymenuPage);
        return responseResult;
    }
    @PostMapping("/deleteTodaymenus")
    public ResponseResult deleteTodaymenus(@RequestBody Integer[] tids){
        todaymenuService.deleteTodaymenus(tids);
        ResponseResult responseResult=new ResponseResult<>();
        return responseResult;
    }
}
